********************************************************************************
* All states
********************************************************************************

use dataset_voters, clear

eststo clear
eststo, title("All years"): areg turnout anywells i.year, a(zipcode) cl(zipcode)
estadd local ZFE = "Yes"
estadd local YFE = "Yes"
eststo, title("> 2000"): areg turnout anywells i.year ///
    if year > 2000, a(zipcode) cl(zipcode)
estadd local ZFE = "Yes"
estadd local YFE = "Yes"
eststo, title("> 2004"): areg turnout anywells i.year ///
    if year > 2004, a(zipcode) cl(zipcode)
estadd local ZFE = "Yes"
estadd local YFE = "Yes"
eststo, title("> 2008"): areg turnout anywells i.year ///
    if year > 2008, a(zipcode) cl(zipcode)
estadd local ZFE = "Yes"
estadd local YFE = "Yes"

label variable anywells "Any wells"

#delimit;

esttab 
	using "_output/tableA16a.tex"
	,
		replace
		booktabs
		drop(*year* _cons)
		cells(b(fmt(3) star) se(par))
		compress
		label
		gap
		collabels(none)
		mtitles("All years" "> 2000")
		width(\linewidth)
		stats(
			YFE
			ZFE
			N_clust
			N
			,
				label(
					"Year fixed effects"
					"Zip code fixed effects" 
					"Clusters"
					"Observations"
				)
				fmt(0 %20.0fc)
		)
		;
	
#delimit cr

********************************************************************************
* High-fracking states
********************************************************************************

keep if highf == 1

eststo clear
eststo, title("All years"): areg turnout anywells i.year, a(zipcode) cl(zipcode)
estadd local ZFE = "Yes"
estadd local YFE = "Yes"
eststo, title("> 2000"): areg turnout anywells i.year ///
    if year > 2000, a(zipcode) cl(zipcode)
estadd local ZFE = "Yes"
estadd local YFE = "Yes"
eststo, title("> 2004"): areg turnout anywells i.year ///
    if year > 2004, a(zipcode) cl(zipcode)
estadd local ZFE = "Yes"
estadd local YFE = "Yes"
eststo, title("> 2008"): areg turnout anywells i.year ///
    if year > 2008, a(zipcode) cl(zipcode)
estadd local ZFE = "Yes"
estadd local YFE = "Yes"

#delimit;

esttab 
	using "_output/tableA16b.tex"
	,
		replace
		booktabs
		drop(*year* _cons)
		cells(b(fmt(3) star) se(par))
		compress
		label
		gap
		collabels(none)
		mtitles("All years" "> 2000")
		width(\linewidth)
		stats(
			YFE
			ZFE
			N_clust
			N
			,
				label(
					"Year fixed effects"
					"Zip code fixed effects" 
					"Clusters"
					"Observations"
				)
				fmt(0 %20.0fc)
		)
		;
	
#delimit cr

********************************************************************************
* End
********************************************************************************
